package com.heima.mapper;

import com.github.pagehelper.Page;
import com.heima.pojo.Partner;
import com.heima.pojo.dto.PartnerPageDto;
import org.apache.ibatis.annotations.*;

@Mapper
public interface PartnerMapper {

    @Insert("insert INTO tb_partner(name,contact,mobile,ratio,account,password,create_time,update_time) \n" +
            "values(#{name},#{contact},#{mobile},#{ratio},#{account},#{password},#{createTime},#{updateTime})")
    void addPartner(Partner partner);

    Page<Partner> pageQuery(PartnerPageDto dto);

    @Select("select * from tb_partner where id = #{id}")
    Partner getInfo(Integer id);

    void update(Partner partner);

    @Delete("delete from tb_partner where id = #{id}")
    void delById(Integer id);

    @Select("select count(*) from tb_partner")
    Integer count();

    @Update("update tb_partner set password = '123456' where id = #{id}")
    void resetPassword(Integer id);
}
